/*
 * KDMUserTrackingAction.cpp
 *
 *  Created on: Jul 8, 2011
 *      Author: blyth
 */

#include <KDMSteppingAction.hh>
#include <KDMGlobals.hh>
#include <G4String.hh>
#include <G4Track.hh>
#include <iostream>
using namespace std;

KDMSteppingAction::KDMSteppingAction() {
	;
}

KDMSteppingAction::~KDMSteppingAction() {
	;
}

void KDMSteppingAction::UserSteppingAction(const G4Step* step) {
	G4Track* track = step->GetTrack();
	G4String volName = track->GetVolume()->GetName();

	if (volName.contains("BHVeto"))
		BHVeto = true;
	else if (volName.contains("smallCrystal") || volName.contains("largeCrystal")) {
		G4String nextVolName = track->GetNextVolume()->GetName();
		if (nextVolName.contains("crystalBlock"))
			sideVeto = true;
		else if (nextVolName.contains("rearVeto"))
			rearVeto = true;
		else if (nextVolName.contains("frontVeto"))
			frontVeto = true;
	} else if (volName.contains("world")) {
		G4String nextVolName = track->GetNextVolume()->GetName();
		if (nextVolName.contains("space"))
			barrelVeto = true;
	}
}
